﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Coolite.Ext;
using Coolite.Ext.Web;
using SubSonic;
using CXDB; 
public partial class User_passwd : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void modify(object s, AjaxEventArgs e)
    {
        Query q = new Query(CxUserBase.Schema);
        q.AddWhere("uid", Cookies.getCookies("cuid"));
        q.AddWhere("passwd", tfpasswd1.Text);
        if (q.GetRecordCount() > 0)
        {
            if (tfpasswd2.Text == tfpasswd3.Text && tfpasswd3.Text.Trim() != "")
            {
                CxUserBase cx = new CxUserBase("uid", Cookies.getCookies("cuid"));
                cx.PassWD = tfpasswd2.Text;
                cx.Save();
                tfpasswd1.Text = "";
                tfpasswd2.Text = "";
                tfpasswd3.Text = "";
                Ext.MessageBox.Show(new MessageBox.Config
                {
                    Buttons = MessageBox.Button.OK,
                    Icon = MessageBox.Icon.NONE,
                    Title = "成功",
                    Message = "密码修改成功!",
                    Width = 300
                });
            }
            else
            {
                Ext.MessageBox.Show(new MessageBox.Config
                {
                    Buttons = MessageBox.Button.OK,
                    Icon = MessageBox.Icon.WARNING,
                    Title = "错误",
                    Message = "两次输入密码不一致!",
                    Width = 300
                });
            }
        }
        else
        {
            Ext.MessageBox.Show(new MessageBox.Config
            {
                Buttons = MessageBox.Button.OK,
                Icon = MessageBox.Icon.WARNING,
                Title = "错误",
                Message = "原始密码输入错误！",
                Width = 300
            });
        }
    }

}
